package com.bianmaba;

import com.bianmaba.commons.annotation.WrapResult;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.LinkedHashMap;
import java.util.Map;

@RestController
public class GlobalController {

    @RequestMapping({"/get_localhost"})
    public Object getLocalhost(HttpServletRequest request) {
        String host = request.getRemoteHost();
        return host;
    }

    @RequestMapping({"/load_initial_information"})
    @WrapResult
    public Object loadInitialInformation(HttpServletRequest request) {
        Map<String, Object> inf = new LinkedHashMap<String, Object>(0);
        String host = request.getRemoteHost();
        inf.put("localhost", host);
        return inf;
    }


}
